package net.aynt.blog.handler;

import net.aynt.core.exception.Exceptions;
import net.aynt.core.mvc.ExceptionHandler;
import net.aynt.core.mvc.WebContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SimpleExceptionHandler implements ExceptionHandler {
	private static final Logger log = LoggerFactory
			.getLogger(SimpleExceptionHandler.class);

	protected static final String ERROR_PAGE = "error/500";

	public String handle(WebContext rc, Exception exception) {
		log.error(Exceptions.getStackTraceAsString(exception));

		rc.setRequestAttr("exception", exception);
//		rc.setRequestAttr("errorMsg", exception.getCause().getMessage());
		return ERROR_PAGE;
	}

}
